package com.ruoyi.project.qyxy.persondtl.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.qyxy.persondtl.domain.QuaPersonSocreDetail;
import com.ruoyi.project.qyxy.persondtl.service.IQuaPersonSocreDetailService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 资质人员详细得分信息Controller
 * 
 * @author lcl
 * @date 2021-03-11
 */
@RestController
@RequestMapping("/qyxy/persondtl")
public class QuaPersonSocreDetailController extends BaseController
{
    @Autowired
    private IQuaPersonSocreDetailService quaPersonSocreDetailService;

    /**
     * 查询资质人员详细得分信息列表
     */
    @PreAuthorize("@ss.hasPermi('qyxy:persondtl:list')")
    @GetMapping("/list")
    public TableDataInfo list(QuaPersonSocreDetail quaPersonSocreDetail)
    {
        startPage();
        List<QuaPersonSocreDetail> list = quaPersonSocreDetailService.selectQuaPersonSocreDetailList(quaPersonSocreDetail);
        return getDataTable(list);
    }

    /**
     * 导出资质人员详细得分信息列表
     */
    @PreAuthorize("@ss.hasPermi('qyxy:persondtl:export')")
    @Log(title = "资质人员详细得分信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QuaPersonSocreDetail quaPersonSocreDetail)
    {
        List<QuaPersonSocreDetail> list = quaPersonSocreDetailService.selectQuaPersonSocreDetailList(quaPersonSocreDetail);
        ExcelUtil<QuaPersonSocreDetail> util = new ExcelUtil<QuaPersonSocreDetail>(QuaPersonSocreDetail.class);
        return util.exportExcel(list, "persondtl");
    }

    /**
     * 获取资质人员详细得分信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('qyxy:persondtl:query')")
    @GetMapping(value = "/{detailId}")
    public AjaxResult getInfo(@PathVariable("detailId") Long detailId)
    {
        return AjaxResult.success(quaPersonSocreDetailService.selectQuaPersonSocreDetailById(detailId));
    }

    /**
     * 新增资质人员详细得分信息
     */
    @PreAuthorize("@ss.hasPermi('qyxy:persondtl:add')")
    @Log(title = "资质人员详细得分信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QuaPersonSocreDetail quaPersonSocreDetail)
    {
        return toAjax(quaPersonSocreDetailService.insertQuaPersonSocreDetail(quaPersonSocreDetail));
    }

    /**
     * 修改资质人员详细得分信息
     */
    @PreAuthorize("@ss.hasPermi('qyxy:persondtl:edit')")
    @Log(title = "资质人员详细得分信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QuaPersonSocreDetail quaPersonSocreDetail)
    {
        return toAjax(quaPersonSocreDetailService.updateQuaPersonSocreDetail(quaPersonSocreDetail));
    }

    /**
     * 删除资质人员详细得分信息
     */
    @PreAuthorize("@ss.hasPermi('qyxy:persondtl:remove')")
    @Log(title = "资质人员详细得分信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{detailIds}")
    public AjaxResult remove(@PathVariable Long[] detailIds)
    {
        return toAjax(quaPersonSocreDetailService.deleteQuaPersonSocreDetailByIds(detailIds));
    }
}
